home *** CD-ROM | disk | FTP | other *** search
/ Champak 130 / Vol 130.iso / games / target_s.swf / scripts / assets / effects / star1.as < prev   
Encoding:
Text File  |  2008-11-13  |  1.8 KB  |  77 lines

  1. package assets.effects
  2. {
  3.    import flash.display.*;
  4.    import flash.events.*;
  5.    
  6.    [Embed(source="/_assets/assets.swf", symbol="assets.effects.star1")]
  7.    public class star1 extends MovieClip
  8.    {
  9.        
  10.       
  11.       private var count:Number = 0;
  12.       
  13.       public var clip:Object;
  14.       
  15.       public var scope:Object;
  16.       
  17.       private var dist:Number;
  18.       
  19.       private var spd:Number;
  20.       
  21.       private var ang:Number;
  22.       
  23.       public function star1(param1:*, param2:*)
  24.       {
  25.          count = 0;
  26.          super();
  27.          addFrameScript(0,frame1,5,frame6);
  28.          clip = param1;
  29.          scope = param2;
  30.          ang = Math.round(Math.random() * 360) * (Math.PI / 180);
  31.          dist = Math.round(Math.random() * 10);
  32.          spd = Math.round(Math.random() * 10);
  33.          scaleX = scaleY = 0.25 + Math.random() * 0.25;
  34.          if(Math.round(Math.random()))
  35.          {
  36.             gotoAndStop("white");
  37.          }
  38.          addEventListener(Event.ENTER_FRAME,run);
  39.       }
  40.       
  41.       private function removal() : *
  42.       {
  43.          removeEventListener(Event.ENTER_FRAME,run);
  44.          clip.removeChild(this);
  45.       }
  46.       
  47.       internal function frame6() : *
  48.       {
  49.          stop();
  50.       }
  51.       
  52.       internal function frame1() : *
  53.       {
  54.          stop();
  55.       }
  56.       
  57.       private function run(param1:Event) : *
  58.       {
  59.          var _loc2_:* = undefined;
  60.          scaleX = scaleY = scaleY + 0.05;
  61.          rotation += 2;
  62.          x += spd * Math.cos(ang);
  63.          y += spd * Math.sin(ang);
  64.          _loc2_ = scope.vx * ((y - scope.pp.y) / scope.pp.y);
  65.          x -= Math.abs(_loc2_);
  66.          if(count < dist)
  67.          {
  68.             ++count;
  69.          }
  70.          else
  71.          {
  72.             removal();
  73.          }
  74.       }
  75.    }
  76. }
  77.